﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using YiYiTong.Rocket.Model;
using YiYiTong.Rocket.Helper;
using YiYiTong.Rocket.Business;
using YiYiTong.Rocket.Entity;
using YiYiTong.Rocket.EFDBFirst;

namespace YiYiTong.Rocket.Api.Biz
{
    public class ReleaseService : ApiService
    {
        /// <summary>
        /// 更新列表
        /// </summary>
        /// <returns></returns>
        public void GetList(ApiServiceContext apiContext)
        {
            ApiHttpResponse apiResponse = new ApiHttpResponse();
            string data = apiContext.decData;

            ADZ_MasterEntities dbcontext = new ADZ_MasterEntities();

            ReleaseListModel listModel = new ReleaseListModel();
            listModel.releaselist = new List<ListModel>();
            var list = dbcontext.ADZ_ListRelease.ToList();
            list.ForEach(t =>
            {
                ListModel model = new ListModel
                {
                    create_time = t.create_time.ToString(1),
                    list_type = t.list_type,
                    release_no = t.release_no
                };
                listModel.releaselist.Add(model);
            });

            apiResponse.retCode = ResultEnum.Success;
            apiResponse.data = JsonHelper.Serialize(listModel);

            apiContext.apiHttpResp = apiResponse;
        }

    }
}